home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / prof / ds5000.md / profInt.h < prev    next >
C/C++ Source or Header  |  1990-10-19  |  2KB  |  85 lines

  1. /*
  2.  * profInt.h --
  3.  *
  4.  *    Internal declarations of the profile module.
  5.  *
  6.  * Copyright 1986, 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/kernel/prof/ds3100.md/RCS/profInt.h,v 1.2 90/10/19 15:55:16 rab Exp $ SPRITE (DECWRL)
  16.  */
  17.  
  18. #ifndef _PROFINT
  19. #define _PROFINT
  20.  
  21. /* procedures */
  22.  
  23. extern void mcount _ARGS_((void));
  24.  
  25. /*
  26.  * A histogram of PC samples is kept for use by gprof.
  27.  * Each sample is a counter that gets incremented when
  28.  * the PC is in the range for the counter.  The PC's are
  29.  * clustered in groups of 1, 2, 4, 8... values and there
  30.  * is a counter for each group.  A groupsize of 1 means there
  31.  * is a counter for every possible PC value.  The even sizes of
  32.  * the groups lets us generate the index into the array of counters
  33.  * by shifting.  (The about to shift also takes into account the
  34.  * size of an instruction, it averages that to two bytes!)
  35.  */
  36.  
  37. #define PROF_PC_GROUP_SIZE    2
  38. #define PROF_GROUP_SHIFT    1
  39. #define PROF_ARC_GROUP_SHIFT    4
  40. #define PROF_INSTR_SIZE_SHIFT    2
  41. #define PROF_PC_SHIFT        (PROF_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  42.  
  43. /*
  44.  * Storage is set aside to hold call graph arc execution counts.
  45.  * The number of arcs stored is the number of instruction in the
  46.  * kernel divided by CALL_RATIO. ie. This represents the proportion
  47.  * of the instructions that are calls.
  48.  */
  49.  
  50. #define PROF_CALL_RATIO     1
  51.  
  52. /*
  53.  * A raw call graph arc just includes the callee's PC and the number of
  54.  * times the arc was executed.  The caller of the arc is the index of the
  55.  * arcIndex index shifted by PROF_ARC_SHIFT.
  56.  */
  57. #define PROF_ARC_SHIFT        (PROF_ARC_GROUP_SHIFT + PROF_INSTR_SIZE_SHIFT)
  58. typedef struct ProfRawArc {
  59.     int    calleePC;
  60.     int    count;
  61.     struct ProfRawArc *link;
  62. } ProfRawArc;
  63.  
  64. typedef struct ProfArc {
  65.     int    callerPC;
  66.     int    calleePC;
  67.     int    count;
  68. } ProfArc;
  69.  
  70. extern int        profArcListSize;
  71. extern ProfRawArc    *profArcList;
  72. extern ProfRawArc    *profArcListFreePtr;
  73. extern ProfRawArc    *profArcListEndPtr;
  74.  
  75. extern int        profArcIndexSize;
  76. extern ProfRawArc    **profArcIndex;
  77.  
  78. /*
  79.  * An of/off switch for profiling.
  80.  */
  81.  
  82. extern Boolean profEnabled;
  83.  
  84. #endif /* _PROFINT */
  85.